package com.nineteenlou.valueApp.love.enums;

import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;


public enum ${className} {

    <#list enumlist as enum>    
    ${enum.enumName}(${enum.value},"${enum.desc}"),
    </#list>

    private int value;

    private String desc;

    private ${className}(int value, String desc){
        this.value = value;
        this.desc = desc;
    }

    private static final Map<Integer,${className}> integerToEnum = new HashMap<Integer,${className}>();

    static {
        for (${className} enum1 : values()) {
            integerToEnum.put(enum1.getValue(), enum1);
        }
    }

    public static ${className} getFromInt(int value) {
        return integerToEnum.get(value);
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
    
    public static Map<String,String> getValueAndDesc(){
         Map<String,String> map = new TreeMap<String, String>();
         for(Integer key:integerToEnum.keySet()){
              map.put(String.valueOf(key),integerToEnum.get(key).getDesc());
         }
         return map;
    }
    


}
